<template>
	<view>
		<Home v-if="PageCur=='home'"></Home>
		<!-- <Order v-if="PageCur=='order'"></Order> -->
		<Notice v-if="PageCur=='notice'"></Notice>
		<Myself v-if="PageCur=='myself'"></Myself>
		<view class="cu-bar tabbar bg-white shadow foot">
			<view class="action" @click="NavChange" data-cur="home">
				<view class='cuIcon-cu-image'>
					<image :src="'/static/tabbar/home' + [PageCur=='home'?'click':'normal'] + '@2x.png'"></image>
				</view>
				<view :class="PageCur=='basics'?'text-green':'text-gray'">首页</view>
			</view>
			<view class="action" @click="NavChange" data-cur="notice">
				<view class='cuIcon-cu-image'>
					<image :src="'/static/tabbar/notice' + [PageCur=='notice'?'click':'normal'] + '@2x.png'"></image>
				</view>
				<view :class="PageCur=='notice'?'text-green':'text-gray'">比分</view>
			</view>
			<view class="action" @click="NavChange" data-cur="myself">
				<view class='cuIcon-cu-image'>
					<image :src="'/static/tabbar/wd' + [PageCur=='myself'?'click':'normal'] + '@2x.png'"></image>
				</view>
				<view :class="PageCur=='myself'?'text-green':'text-gray'">我的</view>
			</view>
		</view>
	</view>
</template>
<script>
	import Home from "./index/index"
	import Order from "./order/index.vue"
	import Notice from "./notice/index.vue"
	import Myself from "./user/index.vue"
	export default {
		components: {
			Home,
			Order,
			Notice,
			Myself
		},
		data() {
			return {
				PageCur: 'notice'
			}
		},
		mounted() {

		},
		methods: {
			/**
			 * 打开数据库
			 */
			checkOpenDb() {
				let openDb = () => {
					plus.sqlite.openDatabase({
						name: 'data',
						path: '_doc/data.db',
						success: function(e) {
							
							console.log('openDatabase success!');
						},
						fail: function(e) {
							
							console.log('openDatabase failed: ' + JSON.stringify(e));
						}
					});
				}
				plus.sqlite.isOpenDatabase({
					name: "data",
					path: "_doc/data.db",
					success: function(e) {
						openDb();
						console.log('openDatabase success!');
					},
					fail: function(e) {
						console.log('openDatabase failed: ' + JSON.stringify(e));
					}
				})
			},
			/**
			 * @param {Object} e
			 */
			NavChange: function(e) {
				
				plus.webview.close("bifen");
				
				this.PageCur = e.currentTarget.dataset.cur
			}
		}
	}
</script>

<style>

</style>
